import request from '@/plugin/axios'

// 批量创建用户账号genLoginAccount
export function genLoginAccount(params) {
    return request({
        url: '/upms/user/genLoginAccount',
        method: 'get',
        params: request.adornParams(params,false)
    })
}
/**
 * 查询用户权限信息
 */
export function getUserPermissionInfo() {
    return request({
        url: '/upms/user/getUserPermissionInfo',
        method: 'get',
        params: request.adornParams({})
    })
}

// 获取组织下的用户列表
export function getuserlistByOrgs(pkOrgs) {
    return request({
        url: '/upms/org/user/' + pkOrgs,
        method: 'get',
        params: request.adornParams({})
    })
}

//某个组织下未分配某个角色的用户列表
export function getUserByOrgsNoRole(pkOrgs,pkRole) {
    return request({
        url: '/upms/org/user/'+pkOrgs+'/norole/'+pkRole,
        method: 'get',
        params: request.adornParams({})
    })
}
// 查询某个集团下的用户列表
export function getuserlistByGroup(pkGroup) {
    return request({
        url: '/upms/group/user/' + pkGroup,
        method: 'get',
        params: request.adornParams({})
    })
}

// 查询某个用户组下的用户列表
export function getuserlistByUsergroup(pkUsergroup) {
    return request({
        url: '/upms/usergroup/users/' + pkUsergroup,
        method: 'get',
        params: request.adornParams({})
    })
}

// 获取列表
export function getuserlist(params) {
    return request({
        url: '/upms/user/list',
        method: 'get',
        params: request.adornParams(params)
    })
}
// 获取分页列表
export function getuserPage(params) {
    return request({
        url: '/upms/user/page',
        method: 'get',
        params: request.adornParams(params)
    })
}

// 获取信息
export function getuserinfo(id) {
    return request({
        url: '/upms/user/info/' + id,
        method: 'get',
        params: request.adornParams({})
    })
}

// 获取我的信息
export function getmeinfo() {
    return request({
        url: '/upms/user/me',
        method: 'get',
        params: request.adornParams({})
    })
}

// 获取同组织用户
export function getsameorguser() {
    return request({
        url: '/upms/user/org/user',
        method: 'get',
        params: request.adornParams({})
    })
}

// 获取系统用户列表信息
export function getadminuser() {
    return request({
        url: '/upms/user/admin/dict',
        method: 'get',
        params: request.adornParams({})
    })
}

// 获取业务用户列表信息
export function getbususer() {
    return request({
        url: '/upms/user/bus/dict',
        method: 'get',
        params: request.adornParams({})
    })
}

// 添加
export function adduser(data) {
    return request({
        url: '/upms/user/save',
        method: 'post',
        data
    })
}

// 添加集团管理员
export function addAdmin(data) {
    return request({
        url: '/upms/user/admin/save',
        method: 'post',
        data
    })
}
// 修改集团管理员
export function updateAdmin(data) {
    return request({
        url: '/upms/user/admin/update',
        method: 'put',
        data
    })
}
// 保存部门下的用户列表
export function saveDeptUser(data) {
    return request({
        url: '/upms/user/saveDeptUser',
        method: 'post',
        data
    })
}

// 清除部门下的用户列表
export function clearDeptUser(data) {
    return request({
        url: '/upms/user/clearDeptUser',
        method: 'post',
        data: request.adornData(data, false)
    })
}

// 修改
export function updateuser(data) {
    return request({
        url: '/upms/user/update',
        method: 'put',
        data
    })
}
// 重置密码
export function resetPassword(userId) {
    return request({
        url: '/upms/user/resetPassword/'+userId,
        method: 'put'
    })
}
// 批量删除
export function delBatchuser(params) {
    return request({
        url: '/upms/user/delete',
        method: 'delete',
        data: request.adornData(params, false)
    })
}

// 删除
export function deluser(id) {
    return request({
        url: '/upms/user/delete/' + id,
        method: 'delete',
    })
}